<template>
  <up-tabbar
    :value="tabbarIndex"
    :fixed="true"
    :placeholder="false"
    :safeAreaInsetBottom="true"
  >
    <up-tabbar-item text="首页" icon="home" size="30" @click="tabbar(1)"></up-tabbar-item>
    <up-tabbar-item
      text="接单"
      icon="order"
      size="30"
      @click="tabbar(2)"
    ></up-tabbar-item>
    <up-tabbar-item
      text="社交"
      icon="weixin-fill"
      size="30"
      @click="tabbar(3)"
    ></up-tabbar-item>
    <up-tabbar-item
      text="学习"
      icon="file-text"
      size="30"
      @click="tabbar(4)"
    ></up-tabbar-item>
    <up-tabbar-item
      text="我的"
      icon="account"
      size="30"
      @click="tabbar(5)"
    ></up-tabbar-item>
  </up-tabbar>
</template>

<script setup lang="ts">
import { useVModel } from '@vueuse/core';
const props = defineProps({
  tabbarIndex: {
        type: Number,
        default: 0
    },
})
const emit = defineEmits(['update:tabbarIndex']);
const tabbarIndex = useVModel(props, 'tabbarIndex', emit)
const tabbar = (index: any) => {
  let path = "";
  // tabbarIndex.value = index;
  switch (index) {
    case 1:
      path = `/indexPages/index/index`;
      break;
    case 2:
      path = `/orderPages/order/order`;
      break;
    case 3:
      path = `/socialPages/social/social`;
      break;
    case 4:
      path = `/learnPages/learn/learn`;
      break;
    case 5:
      path = `/myPages/myPage/myPage`;
      break;
    default:
  }
  uni.redirectTo({
    url: path,
  });
};
</script>

<style lang="scss" scoped>
.content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.logo {
  height: 200rpx;
  width: 200rpx;
  margin-top: 200rpx;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 50rpx;
}

.text-area {
  display: flex;
  justify-content: center;
}

.title {
  font-size: 36rpx;
  color: #8f8f94;
}

:deep(.u-icon__icon) {
  font-size: 30px !important;
}
</style>
